package com.julis.activity.setting.deviceweihu;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.Constant;
import com.baseutils.SpfUtils;
import com.julis.R;
import com.suke.widget.SwitchButton;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * psam卡设置
 */
public class PSAM_Activity extends AppCompatActivity {

    @BindView(R.id.img_back)
    RelativeLayout imgBack;
    @BindView(R.id.tv_checkpsam)
    TextView tvCheckpsam;
    @BindView(R.id.button_checkpsam)
    SwitchButton buttonCheckpsam;
    @BindView(R.id.activity_seetting)
    LinearLayout activitySeetting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_psam);
        ButterKnife.bind(this);
        boolean Check_Psam = (boolean) SpfUtils.get(this, Constant.Check_Psam, true);
        buttonCheckpsam.toggle();
        if (Check_Psam) {
            buttonCheckpsam.setChecked(true);
        } else {
            buttonCheckpsam.setChecked(false);
        }
        buttonCheckpsam.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(SwitchButton view, boolean isChecked) {
                if (isChecked) {
                    SpfUtils.put(PSAM_Activity.this, Constant.Check_Psam, true);
                } else {
                    SpfUtils.put(PSAM_Activity.this, Constant.Check_Psam, false);
                }

            }
        });
    }

    @OnClick(R.id.img_back)
    public void onViewClicked() {
        finish();
    }
}
